- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5
SF-3622 Definitively associate draft generation metrics #3521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| Codecov Report❌ Patch coverage is  Additional details and impacted files@@            Coverage Diff             @@
##           master    #3521      +/-   ##
==========================================
+ Coverage   82.47%   82.48%   +0.01%     
==========================================
  Files         615      615              
  Lines       36935    37009      +74     
  Branches     6014     6031      +17     
==========================================
+ Hits        30463    30528      +65     
  Misses       5585     5585              
- Partials      887      896       +9     ☔ View full report in Codecov by Sentry. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements tracking of draft generation requests across related NMT drafting events by adding a draftGenerationRequestId tag. This SF-specific identifier is generated at the start of pre-translation builds and propagated through the system using Activity.Current.Tags, method parameters, and event metric lookups.
Key Changes:
- Added Tagsfield toEventMetricmodel to store Activity tags
- Modified EventMetricServiceto collect and save tags from Activity chain (child overrides parent)
- Updated MachineProjectServiceandMachineApiServiceto propagatedraftGenerationRequestIdthrough method signatures and Activity tags
- For SMT builds, nullis passed fordraftGenerationRequestId
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description | 
|---|---|
| EventMetric.cs | Added Tagsdictionary property to store Activity metadata | 
| event-metric.ts | Added optional tagsfield to TypeScript interface | 
| EventMetricService.cs | Implemented Activity tag collection from parent/child chain with child override logic | 
| EventMetricLogger.cs | Created Activity instances to enable tag propagation through intercepted methods | 
| MachineApiService.cs | Generated draftGenerationRequestIdfor NMT builds and looked up IDs from BuildProjectAsync events | 
| MachineProjectService.cs | Added draftGenerationRequestIdparameter and Activity tag setting for build methods | 
| IMachineProjectService.cs | Updated interface signature with new optional parameter | 
| SyncService.cs | Passed nullfordraftGenerationRequestIdwhen triggering SMT builds | 
| EventMetricServiceTests.cs | Added tests for Activity tag collection and parent/child override behavior | 
| MachineProjectServiceTests.cs | Updated all test calls with draftGenerationRequestId: nulland added Activity tag verification test | 
| MachineApiServiceTests.cs | Added mocks for GetDraftGenerationRequestIdForBuildAsyncand tests for tag propagation | 
        
          
                test/SIL.XForge.Scripture.Tests/Services/MachineApiServiceTests.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
        
          
                test/SIL.XForge.Scripture.Tests/Services/MachineApiServiceTests.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
        
          
                test/SIL.XForge.Scripture.Tests/Services/MachineApiServiceTests.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
Records SF request id to help find related events. Drafting event metrics that are associated with the same NMT draft generation request have a 'tags.draftGenerationRequestId' written to them with an SF-specific id. This id is transferred around by Activity.Current.Tags, by method arguments, and looked up by finding a BuildProjectAsync event with a Serval build id. When SMT is used, `null` is passed for draftGenerationRequestId method arguments.
| This is on pause so I can learn more about its usage on the frontend. | 
Records SF request id to help find related events.
Drafting event metrics that are associated with the same NMT draft
generation request have a 'tags.draftGenerationRequestId' written to
them with an SF-specific id. This id is transferred around by
Activity.Current.Tags, by method arguments, and looked up by finding a
BuildProjectAsync event with a Serval build id.
When SMT is used,
nullis passed for draftGenerationRequestId methodarguments.
This change is